import request from '@/utils/request'
/**登陆 */
export const login = ({ username, password }) =>
  request({
    url: `/api/user/login`,
    method: 'post',
    data: {
      username,
      password,
    },
  })
/**获取我的信息 */
export const getme = () =>
  request({
    url: `/api/user/me`,
    method: 'get',
  })
/**从id获取用户信息 */
export const userFromid = ({ id }) =>
  request({
    url: `/api/user/fromid`,
    method: 'get',
    params: { id },
  })
/**违规用户名 */
export const reportName = ({ id }) =>
  request({
    url: `/api/user/report-name`,
    method: 'get',
    params: { id },
  })
/**违规头像 */
export const reportPortrait = ({ id }) =>
  request({
    url: `/api/user/report-portrait`,
    method: 'get',
    params: { id },
  })
/**获取用户列表 */
export const getUserList = ({ qw, page, size }) =>
  request({
    url: `/api/user/list`,
    method: 'get',
    params: {
      qw,
      page,
      size,
    },
  })
/**修改权限 */
export const userPower = ({ id, power }) =>
  request({
    url: `/api/user/power`,
    method: 'post',
    data: {
      id,
      power,
    },
  })
/**获取未读信息数量 */
export const unreadCount = () =>
  request({
    url: `/api/user/unread-count`,
    method: 'get',
  })
/**获取未读信息 */
export const unread = () =>
  request({
    url: `/api/user/unread`,
    method: 'get',
  })
/**标记为已读信息 */
export const read = ({ ids }) =>
  request({
    url: `/api/user/read`,
    method: 'post',
    data: {
      ids,
    },
  })
/**获取所有信息 */
export const allmsg = ({ page, size }) =>
  request({
    url: `/api/user/message`,
    method: 'get',
    params: {
      page,
      size,
    },
  })
/**发送验证码 */
export const authCode = ({ mail }) =>
  request({
    url: `/api/user/auth-code`,
    method: 'get',
    params: {
      mail,
    },
  })
